package cb.wzby;

import java.nio.file.attribute.UserPrincipalLookupService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ListDemo8 {
    public static void main(String[] args) {
        //User u1 = new User(1, "李四", 30);
        //User u2 = new User(1, "李四", 30);
        //System.out.println(u1 == u2);
        //System.out.println(u1.equals(u2));
        List<User> l =new ArrayList<>(List.of(new User(1, "完美", 89),
                new User(1, "程璐", 91),
                new User(1, "宋进", 18),
                new User(1, "文波", 89),
                new User(1, "宝蓝", 80),
                new User(1, "小天", 70)));
        System.out.println(l);
        //用户随机乱序
        Collections.shuffle(l);
        System.out.println(l);
        //根据用户的成绩降序
        Collections.sort(l,(a,b)->b.getScore()-a.getScore());
        System.out.println(l);
    }
}
